<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>notify-delay-rule-add</title>
	<%@ include file="../include/common.jsp"%>
	<%@ include file="../include/form.jsp"%>
	<style type="text/css">
		.tdValue{
			border: 1px solid #D6D3D6;
			line-height: 26px;
			height: 32px;
			padding-left: 5px;
			overflow: hidden;
		}
	</style>
	<script type="text/javascript">
	function closewin(){
		  getTopWin(window).closejBox("add-delay-rule");
	  }
	function add(){
		var stHour = $("#startHour").val();
        var stMin =$("#startMin").val();
        var endHour =$("#endHour").val();
        var endMin= $("#endMin").val();
        var startTime =new Number(stHour*3600)+new Number(stMin*60);
        var endTime = new Number(endHour*3600)+new Number(endMin*60);
			  $.ajax({
				   type: "POST", 
				   url: "${pageContext.request.contextPath}/notify/notify-delay-rule!save.action?startTime="+startTime+"&endTime="+endTime, 
				   data: $("#myform").serialize(), //传的参数
				   dataType: 'json',
				   success: function(data){ //结果
						   var pWin = getTopWin(window).currentWin["add-delay-rule"];
						   pWin.datagrid();
						   getTopWin(window).closejBox("add-delay-rule");
				   }
			});
	}
	$(function(){
		$.formValidator.initConfig({formid:"myform"
	        ,onerror:function(msg){}
	        ,onsuccess:function(){
	      	  		add();
	        		return false;
	        }
	  	});
	})
	</script>
  </head>
  
  <body class="padding-8">
    <form action="" id="myform" name="myform" method="post">
    		<table class="table_eidt">
    			<tr style="height: 50px">
	    			<td class="td_left" width="100px">开始时间</td>
	    			<td class="tdValue">
						<select name="startHour" id="startHour">
				              <%for(int i=0; i<24; i++) {%>
				                  <option value="<%=i %>"<%if(i==22)out.print("selected"); %>><%=i %></option>
				                  <%} %>
				          </select>&nbsp;:&nbsp;
				          <select name="startMin" id="startMin">
				              <%for(int i=0; i<60; i+=5) {%>
				                  <option value="<%=i %>"><%=i %></option>
				                  <%} %>
				          </select>
					</td>
    			</tr>
    			<tr style="height: 50px">
	    			<td class="td_left">结束时间</td>
	    			<td class="tdValue">
	    				<select name="endHour" id="endHour">
				              <%for(int i=0; i<24; i++) {%>
				                  <option value="<%=i %>" <% if(i==7)out.print("selected");%>><%=i %></option>
				                  <%} %>
				          </select>&nbsp;:&nbsp;
				
				          <select name="endMin" id="endMin">
				              <%for(int i=0; i<60; i+=5) {%>
				                  <option value="<%=i %>"><%=i %></option>
				                  <%} %>
				          </select>
	    			</td>
    			</tr>
    			<tr style="height: 50px"  id="vailTime">
	    			<td class="td_left">解释描述</td>
	    			<td class="td_right">
	    				将时间段内产生的通知信息,延迟到结束时间之后进行发送
	    			</td>
    			</tr>
    		</table>
    		<div align="center" style="margin-top:5px;">
	    		<input type="submit" id="button" name="button" value="保存" class="btn-4">
	    		<input type="reset" class="btn-4" value="重置">
	    		<input type="button" value="取消" onclick="closewin();" class="btn-4">
    		</div>
    		<input type="hidden" id="notifyRuleId" name="notifyRuleId" value=${notifyRuleId}>
    	</form>
  </body>
</html>
